(function($, $$){
	var undefined;
	$(function(){
		var infoEditor = $$.fancyTabDialog({
			text: 'Edit info',
			content: $('#components .editor').clone(true, true),
			morphStart: $('a.edit_tags'),
			modal: false,
			loaded:function(){
				this.showTab(0);
			},
			defaultButtons: false,
			buttons: [
				$$.button({
					name: 'ok',
					text: $('#static_taxt input[name=ok]').val()
				}),
				$$.button({
					name: 'cancel',
					text: $('#static_taxt input[name=cancel]').val()
				})
			],
			ok: function(){alert(1);},
			cancel: function(){this.hide();}
		}).load();
		
		var loginDialog = $$.fancyDialog({
			text: 'Login/Register',
			content: $('#components .login').clone(true, true),
			morphStart: $('a.login')
		}).load();
		
		var uploader = $$.fancyDialog({
			text: 'Upload',
			content: $('#components .upload').clone(true, true),
			morphStart: $('a.upload'),
			modal: false
		}).load();
		
		$('a.edit').click(function(){
			infoEditor.morphStart(this);
			infoEditor.show();
			return false;
		});
		
		$('a.edit_info').click(function(){
			infoEditor.morphStart(this);
			infoEditor.showTab(0).show();
			return false;
		});
		
		$('a.edit_tags').click(function(){
			infoEditor.morphStart (this);
			infoEditor.showTab(1).show();
			return false;
		});
		
		$('a.login').click(function(){
			loginDialog.morphStart (this);
			loginDialog.show();
			return false;
		});
		
		$('a.upload').click(function(){
			uploader.show();
		});
	});
})(jQuery, jkui);